package com.wsoft.sample;

import com.alibaba.fastjson.JSONObject;
import com.wsoft.constant.CommonConstant;
import com.wsoft.utils.CodeRulesUtil;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 定时任务 实例
 * @author z001
 * @since 2024年10月23日 16:16:34
 */
@Slf4j
@Service
public class JobSampleSecond implements Job {

    @Resource
    CodeRulesUtil codeRulesUtil;


    @Override
    public void execute(JobExecutionContext jobExecutionContext){
        //可以从dataMap中获取参数
        JobDataMap dataMap = jobExecutionContext.getMergedJobDataMap();
        System.out.println("执行了/..."+   dataMap.get(CommonConstant.JOB_PARAMS));

        // 写点什么业务逻辑
        JSONObject parse = JSONObject.parseObject("{\"id\":1,\"name\":\"tom\",\"age\":\"18\",\"type\":\"wjfz\"}");
        Object object = codeRulesUtil.initCode("wsCode", parse, 1);
        System.out.println(object);
    }
}
